<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>推荐好友</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-sharebox.js" ></script>
    <script type="text/javascript" src="./script/aui-tab.js" ></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript">
        function closeWin(){
            api.closeWin({
            });
        };
    </script>
</head>
<body>
    <style>
        body{background:#f9f7e8; height:auto;}
    </style>
    <!-- 头部 -->
    <header class="aui-bar aui-bar-nav" id="topbar">
        <a class="aui-pull-left aui-btn" onclick="closeWin()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">推荐好友</div>
        <a class="aui-pull-right aui-bar-nav-r" tapmode onclick="">推荐记录</a>
    </header>
    <div class="recommend-friends-banner">
        <img src="image/h5_banner.jpg">
    </div>
    <div class="recommend-friends-t">
        <span class="fa fa-grav"></span>
        活动期间邀请好友，双方得奖励，红包、加息应有尽有
    </div>
    <div class="recommend-friends">
        <img src="image/h5_award.png">
        <p>查看活动规则</p>
        <span>您已成功邀请 1 人，累计获得红包 3 个</span>
    </div>
    <div class="recommend-friends-btn" tapmode onclick="openSharebox();">马上邀请好友</div>
</body>
<script type="text/javascript">

    // 8月统计
    function my_fund_bill(){
        var delay = 0;
        if(api.systemType != 'ios'){
            // delay = 300;
        }
        api.openWin({
            name: 'my_fund_bill',
            url: './my-fund-bill.html',
            bounces:false,
            delay: delay,
            slidBackEnabled:true,
            vScrollBarEnabled:false,
            progress:{
                type:"page"
            }
        });
    };

    var sharebox = new auiSharebox();
    function openSharebox(){
        sharebox.init({
            //frameBounces:true,//当前页面是否弹动，（主要针对安卓端）
            buttons:[{
                image:'./image/share/wx.png',
                text:'微信',
                value:'wx'//可选
            },{
                image:'./image/share/wx-circle.png',
                text:'朋友圈',
                value:'wx-circle'
            },{
                image:'./image/share/qq.png',
                text:'QQ好友',
                value:'qq'
            },{
                image:'./image/share/qzone.png',
                text:'QQ空间',
                value:'qq-qzone'
            },
            // {
            //     image:'./image/share/sina-weibo.png',
            //     text:'新浪微博'
            // }
            ],
            col:4,
            cancelTitle:'关闭'//可选,当然也可以采用下面的方式使用图标
            // cancelTitle:'<i class="aui-iconfont aui-icon-close aui-font-size-16"></i>'//可选
        },function(ret){
            if(ret){
                // 对应按键走相应平台分享
                switch(ret.buttonIndex){
                    case 1:
                    wxShare();
                    break;
                    case 2:
                    friendCircleShare();
                    break;
                    case 3:
                    qqShare();
                    break;
                    case 4:
                    qqQzoneShare();
                    break;
                    case 5:
                    weiboShare();
                    break;
                    default:
                }
            }
        })

    };

    // 微信会话分享
    function wxShare(){
        var wx = api.require('wx');
        wx.shareWebpage({
           apiKey: 'wxdb1aaa8f4affc0c2',
           scene: 'session',
           title: '赚钱啦!!',
           description: '金可贷邀您一起赚大钱!',
           thumb: 'widget://wgt/fenxiang.jpg',
           contentUrl: 'http://www.baidu.com'
       }, function(ret, err) {
        if (ret.status) {
            alert('分享成功');
        } else {
            alert(err.code);
        }
    });
};

    // 微信朋友圈分享
    function friendCircleShare(){
        var wx = api.require('wx');
        wx.shareWebpage({
            apiKey: 'wxdb1aaa8f4affc0c2',
            scene: 'timeline',
            title: '赚钱啦!!',
            description: '金可贷邀您一起赚大钱!',
            thumb: 'widget://wgt/fenxiang.jpg',
            contentUrl: 'http://www.baidu.com'
        }, function(ret, err) {
            if (ret.status) {
                alert('分享成功');
            } else {
                alert(err.code);
            }
        });

    };

    // qq会话分享
    function qqShare(){
        var qq = api.require('qq');
        qq.shareNews({
            type:'QFriend',
            url: 'http://www.baidu.com',
            title: '赚钱啦!!',
            description: '金可贷邀您一起赚大钱!',
            imgUrl: 'widget://wgt/fenxiang.jpg'
        });
    };

    // qq空间分享
    function qqQzoneShare(){

        var qq = api.require('qq');
        qq.shareNews({
            type:'QZone',
            url: 'http://www.baidu.com',
            title: '赚钱啦!!',
            description: '金可贷邀您一起赚大钱!',
            imgUrl: 'https://gss3.bdstatic.com/-Po3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike180%2C5%2C5%2C180%2C60/sign=99a974ea81d4b31ce4319ce9e6bf4c1a/3c6d55fbb2fb4316be6615d32aa4462309f7d31a.jpg'
        });
    };

    // 微博分享
    function weiboShare(){

        var weibo = api.require('weibo');
        weibo.shareWebPage({
            text: '金可贷邀您一起赚大钱!',
            title: '赚钱啦!!',
            description: '金可贷金融平台今日上线',
            thumb: 'widget://wgt/fenxiang.jpg',
            contentUrl: 'http://www.baidu.com'
        }, function(ret, err) {
            if (ret.status) {
                alert('分享成功');
            }
        });
    };

</script>
</html>